﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.XtraEditors.Registrator;
using DevExpress.XtraEditors.ViewInfo;
using DevExpress.XtraEditors.Drawing;
using DevExpress.XtraEditors;
using System.ComponentModel;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.Data.Filtering.Helpers;
using DevExpress.Data.Filtering;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid;

namespace MultiColumnFilterTest
{
	[UserRepositoryItem("RegisterCustomGridLookUpEdit")]
	public class RepositoryItemCustomGridLookUpEdit : RepositoryItemGridLookUpEdit
	{
		static RepositoryItemCustomGridLookUpEdit() { RegisterCustomGridLookUpEdit(); }

		public RepositoryItemCustomGridLookUpEdit()
		{
			TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
			AutoComplete = false;
		}
		[Browsable(false)]
		public override DevExpress.XtraEditors.Controls.TextEditStyles TextEditStyle
		{
			get
			{
				return
					base.TextEditStyle;
			}
			set { base.TextEditStyle = value; }
		}
		public const string CustomGridLookUpEditName = "CustomGridLookUpEdit";

		public override string EditorTypeName { get { return CustomGridLookUpEditName; } }

		public static void RegisterCustomGridLookUpEdit()
		{
			EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomGridLookUpEditName,
			  typeof(CustomGridLookUpEdit), typeof(RepositoryItemCustomGridLookUpEdit),
			  typeof(GridLookUpEditBaseViewInfo), new ButtonEditPainter(), true));
		}

		protected override GridView CreateViewInstance() { return new CustomGridView(); }
		protected override GridControl CreateGrid() { return new CustomGridControl(); }
	}


	public class CustomGridLookUpEdit : GridLookUpEdit
	{
		static CustomGridLookUpEdit()
		{
			RepositoryItemCustomGridLookUpEdit.RegisterCustomGridLookUpEdit();
		}

		public CustomGridLookUpEdit() : base() { }

		public override string EditorTypeName
		{
			get
			{
				return
					RepositoryItemCustomGridLookUpEdit.CustomGridLookUpEditName;
			}
		}

		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		public new RepositoryItemCustomGridLookUpEdit Properties
		{
			get
			{
				return base.Properties as
					RepositoryItemCustomGridLookUpEdit;
			}
		}
	}
}